package com.gitee.wsl.ext.array

import kotlin.math.min

fun FloatArray.min(other:FloatArray){
    this.mix(other.minSize(size),::min)
}

fun DoubleArray.min(other:DoubleArray){
    this.mix(other.minSize(size),::min)
}

fun IntArray.min(other:IntArray){
    this.mix(other.minSize(size),::min)
}

fun DoubleArray.minOrElse(nil: Double): Double {
    if (isEmpty()) return nil
    var out = Double.POSITIVE_INFINITY
    for (i in 0..lastIndex) out = min(out, this[i])
    return out
}

